Explore City venues (Mumbai)

The city venue data will be use to explore the cities.

  • Firstly the most no a venue will be extracted from a particular city.
  • Then the top 10 most common venue for each neighborhood will be extracted and then the neighborhood will be clustered by kmeans on the basis of most common venues
In [267]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

Initialize an array of cities in which we are interested in

In [268]:
# initialize cities array and perform exploratory data analysis on the selected city
cities = ['Delhi','Mumbai','Kolkata','Chennai']
city = cities[1]
city_venues = pd.read_csv(city + '_venues.csv',index_col = 0)
city_venues.head()
Out[268]:
Neighborhood Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category
0 Amboli 19.129061 72.846451 Cafe Arfa 19.128930 72.847140 Indian Restaurant
1 Amboli 19.129061 72.846451 Shawarma Factory 19.124591 72.840398 Falafel Restaurant
2 Amboli 19.129061 72.846451 5 Spice , Bandra 19.130421 72.847206 Chinese Restaurant
3 Amboli 19.129061 72.846451 Jaffer Bhai's Delhi Darbar 19.137714 72.845909 Mughlai Restaurant
4 Amboli 19.129061 72.846451 Persia Darbar 19.136952 72.846822 Indian Restaurant

Exploratory data Analysis

In [269]:
# see number of venues per neighbourhood
city_venues.groupby('Neighborhood').count().head()
Out[269]:
Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category
Neighborhood
Aarey Milk Colony 1 1 1 1 1 1
Agripada 27 27 27 27 27 27
Altamount Road 73 73 73 73 73 73
Amboli 26 26 26 26 26 26
Amrut Nagar 50 50 50 50 50 50

One hotting the dataframe

In [270]:
# one hot encoding
city_onehot = pd.get_dummies(city_venues[['Venue Category']], prefix="", prefix_sep="")

# add neighborhood column back to dataframe
city_onehot['Neighborhood'] = city_venues['Neighborhood'] 

# move neighborhood column to the first column
fixed_columns = [city_onehot.columns[-1]] + list(city_onehot.columns[:-1])
city_onehot = city_onehot[fixed_columns]

city_onehot['City'] = city
city_onehot.head()
Out[270]:
Neighborhood Accessories Store Afghan Restaurant Airport Airport Food Court Airport Lounge Airport Service Airport Terminal American Restaurant Antique Shop ... Travel & Transport Vegetarian / Vegan Restaurant Video Game Store Whisky Bar Wine Bar Wine Shop Women's Store Yoga Studio Zoo City
0 Amboli 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Mumbai
1 Amboli 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Mumbai
2 Amboli 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Mumbai
3 Amboli 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Mumbai
4 Amboli 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 Mumbai

5 rows × 248 columns

In a city finding the total no. of venues of a particular type and arranginf the dataframe

In [271]:
# group the data per neighborhood
city_grouped = city_onehot.groupby('City').sum().reset_index()
city_grouped = city_grouped.transpose()
city_grouped.columns = city_grouped.iloc[0]
city_grouped.drop(city_grouped.index[[0]],inplace=True)
city_grouped.head()
Out[271]:
City Mumbai
Accessories Store 4
Afghan Restaurant 2
Airport 3
Airport Food Court 1
Airport Lounge 1

Sorting the data frame on the basis of frequency, taking the top 10 and plotting them.

In [272]:
city_grouped.sort_values([city],ascending=False,inplace=True)
city_grouped.iloc[0:10].plot(kind='bar',figsize=(10,5))
plt.title(city + ' Venue distribution')
plt.ylabel('Total no of venues in the City')
plt.xlabel('Venue Categories')
Out[272]:
Text(0.5, 0, 'Venue Categories')

Now we will find the top 10 most common venues

In [273]:
# First, let's write a function to sort the venues in descending order
def return_most_common_venues(row, num_top_venues):
    row_categories = row.iloc[1:]
    row_categories_sorted = row_categories.sort_values(ascending=False)
    
    return row_categories_sorted.index.values[0:num_top_venues]
In [274]:
city_grouped = city_onehot.groupby('Neighborhood').mean().reset_index()
city_grouped.head()
Out[274]:
Neighborhood Accessories Store Afghan Restaurant Airport Airport Food Court Airport Lounge Airport Service Airport Terminal American Restaurant Antique Shop ... Train Station Travel & Transport Vegetarian / Vegan Restaurant Video Game Store Whisky Bar Wine Bar Wine Shop Women's Store Yoga Studio Zoo
0 Aarey Milk Colony 0.0 0.00 0.0 0.0 0.0 0.0 0.0 0.00 0.0 ... 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000
1 Agripada 0.0 0.00 0.0 0.0 0.0 0.0 0.0 0.00 0.0 ... 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.037037
2 Altamount Road 0.0 0.00 0.0 0.0 0.0 0.0 0.0 0.00 0.0 ... 0.0 0.0 0.027397 0.0 0.0 0.0 0.0 0.0 0.013699 0.000000
3 Amboli 0.0 0.00 0.0 0.0 0.0 0.0 0.0 0.00 0.0 ... 0.0 0.0 0.038462 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000
4 Amrut Nagar 0.0 0.02 0.0 0.0 0.0 0.0 0.0 0.02 0.0 ... 0.0 0.0 0.040000 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000

5 rows × 247 columns

In [275]:
# Now let's create the new dataframe and display the top 10 venues for each neighborhood.
num_top_venues = 10

indicators = ['st', 'nd', 'rd']

# create columns according to number of top venues
columns = ['Neighborhood']
for ind in np.arange(num_top_venues):
    try:
        columns.append('{}{} Most Common Venue'.format(ind+1, indicators[ind]))
    except:
        columns.append('{}th Most Common Venue'.format(ind+1))

# create a new dataframe
neighborhoods_venues_sorted = pd.DataFrame(columns=columns)
neighborhoods_venues_sorted['Neighborhood'] = city_grouped['Neighborhood']

for ind in np.arange(city_grouped.shape[0]):
    neighborhoods_venues_sorted.iloc[ind, 1:] = return_most_common_venues(city_grouped.iloc[ind, :], num_top_venues)

neighborhoods_venues_sorted.head()
Out[275]:
Neighborhood 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Aarey Milk Colony Performing Arts Venue Zoo Eastern European Restaurant Food Flower Shop Flea Market Fish Market Field Fast Food Restaurant Farmers Market
1 Agripada Indian Restaurant Fast Food Restaurant Bakery Coffee Shop Zoo Gym Mediterranean Restaurant Movie Theater Donut Shop Nightclub
2 Altamount Road Indian Restaurant Bakery Café Chinese Restaurant Pizza Place Fast Food Restaurant Coffee Shop Sandwich Place Dessert Shop Vegetarian / Vegan Restaurant
3 Amboli Indian Restaurant Coffee Shop Bar Sandwich Place Pizza Place Asian Restaurant Arts & Crafts Store Burger Joint Bakery Tea Room
4 Amrut Nagar Café Lounge Indian Restaurant Clothing Store Pizza Place Electronics Store Fast Food Restaurant Vegetarian / Vegan Restaurant Asian Restaurant Diner

After finding the top 10 venues in a neighborhood, the neighborhood will be clustered by kmeans algorithm

In [276]:
# import necessary packages
from sklearn.datasets import load_iris
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt

Find optimal k for the clustering process.

In [277]:
city_grouped_clustering = city_grouped.drop('Neighborhood', 1)

sse = {}
for k in range(1, 10):
    # run k-means clustering
    kmeans = KMeans(n_clusters=k, random_state=0,max_iter = 1000).fit(city_grouped_clustering)
    city_grouped_clustering["clusters"] = kmeans.labels_
    sse[k] = kmeans.inertia_ # Inertia: Sum of distances of samples to their closest cluster center
plt.figure()
plt.plot(list(sse.keys()), list(sse.values()))
plt.xlabel("Number of cluster")
plt.ylabel("SSE")
plt.show()

From the graph we find the elbow point an then use it to cluster the neighborhoods.

In [278]:
# set number of clusters
kclusters = 3

city_grouped_clustering = city_grouped.drop('Neighborhood', 1)

# run k-means clustering
kmeans = KMeans(n_clusters=kclusters, random_state=0).fit(city_grouped_clustering)

# check cluster labels generated for each row in the dataframe
kmeans.labels_[0:10] 
Out[278]:
array([2, 0, 1, 0, 1, 1, 0, 0, 1, 1])
In [279]:
df = pd.read_csv(city + '_subdiv.csv',index_col=0)
df.head()
Out[279]:
Neighborhood City Latitude Longitude
0 Amboli Mumbai 19.129061 72.846451
1 Chakala Mumbai 19.108360 72.862343
2 D.N. Nagar Mumbai 19.124084 72.831375
3 Four Bungalows Mumbai 19.126301 72.824318
4 JB Nagar Mumbai 19.105770 72.864098

Add clustering labels to the dataframe

In [280]:
# add clustering labels
neighborhoods_venues_sorted.insert(0, 'Cluster Labels', kmeans.labels_)

city_merged = df

# merge toronto_grouped with toronto_data to add latitude/longitude for each neighborhood
city_merged = city_merged.join(neighborhoods_venues_sorted.set_index('Neighborhood'), on='Neighborhood')

# drop the column with nan values after join
city_merged.dropna(inplace=True)

city_merged.head() # check the last columns!
Out[280]:
Neighborhood City Latitude Longitude Cluster Labels 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Amboli Mumbai 19.129061 72.846451 0.0 Indian Restaurant Coffee Shop Bar Sandwich Place Pizza Place Asian Restaurant Arts & Crafts Store Burger Joint Bakery Tea Room
1 Chakala Mumbai 19.108360 72.862343 0.0 Indian Restaurant Hotel Café Fast Food Restaurant Pizza Place Multiplex Restaurant Vegetarian / Vegan Restaurant Hotel Bar Gym
2 D.N. Nagar Mumbai 19.124084 72.831375 1.0 Bar Pizza Place Gym / Fitness Center Vegetarian / Vegan Restaurant Coffee Shop Pub Snack Place Lounge Indian Restaurant Fish Market
3 Four Bungalows Mumbai 19.126301 72.824318 1.0 Pub Chinese Restaurant Café Bar Lounge Seafood Restaurant Indian Restaurant Gym / Fitness Center Coffee Shop Ice Cream Shop
4 JB Nagar Mumbai 19.105770 72.864098 1.0 Hotel Indian Restaurant Café Restaurant Lounge Hotel Bar Asian Restaurant Pizza Place Multiplex Fast Food Restaurant

After clustering the data will be visualized in folium.

In [281]:
# Matplotlib and associated plotting modules
import matplotlib.cm as cm
import matplotlib.colors as colors
import folium

Create a function to ge the lat and long of the center of city using geocoder API

In [282]:
# use geocoder library, if not present use !conda install -c conda-forge geocoder
import geocoder
# Google API key is required for the geocoder library to work, save the API key in OS environment variables as GOOGLE_API_KEY
# and then access thay key here
import os
# Use BING_API_KEY when choosing to use bing geocoding instead of google geocoding.
BING_API_KEY = 'AksNN-3luSfNBssyZ3Ju4i78nIrFLt1UtYo--YWQj9oyfxSwyXkdsqykWk3FeTXB' # os.environ['BING_API_KEY']

# This function will take an adress and return the latlng of that adress
def get_latlng(address):
    # using bing geocoder API since it is better.
    g = geocoder.bing(address, key = BING_API_KEY)
    return pd.Series(g.latlng)
In [283]:
# get latitude and longitude of city to center the map
latitude, longitude = get_latlng(city)
print('Lat : ',latitude,' Long : ',longitude)
Lat :  18.940170288085938  Long :  72.8348617553711

Visualize the neighborhoods before clustering

In [284]:
# Function takes in a data frame with Latitude, Longitude, Neighborhood and City columns and shows it on map
def visualize_area_in_map(data):
    # add markers to map
    for lat, lng, neighborhood, city in zip(data['Latitude'], data['Longitude'], data['Neighborhood'], data['City']):
        label = '{}, {}'.format(neighborhood, city)
        label = folium.Popup(label, parse_html=True)
        folium.CircleMarker(
            [lat, lng],
            radius=2,
            popup=label,
            color='blue',
            fill=True,
            fill_color='#3186cc',
            fill_opacity=0.7,
            parse_html=False).add_to(map)  
    
    return map
In [285]:
# create map of Toronto using latitude and longitude values
map = folium.Map(location=[latitude, longitude], zoom_start=10)

# data to be used for map
data = df.dropna()

visualize_area_in_map(data)
Out[285]:

Visualize the clusters

In [286]:
# create map
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=10)

# set color scheme for the clusters
x = np.arange(kclusters)
ys = [i + x + (i*x)**2 for i in range(kclusters)]
colors_array = cm.rainbow(np.linspace(0, 1, len(ys)))
rainbow = [colors.rgb2hex(i) for i in colors_array]

# add markers to the map
markers_colors = []
for lat, lon, poi, cluster in zip(city_merged['Latitude'], city_merged['Longitude'], city_merged['Neighborhood'], city_merged['Cluster Labels']):
    label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True)
    folium.CircleMarker(
        [lat, lon],
        radius=4,
        popup=label,
        color=rainbow[int(cluster)-1],
        fill=True,
        fill_color=rainbow[int(cluster)-1],
        fill_opacity=0.9).add_to(map_clusters)
       
map_clusters
Out[286]:

Exploring the clusters

In [287]:
# print the cluster
city_merged.loc[city_merged['Cluster Labels'] == 0, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[287]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Mumbai Indian Restaurant Coffee Shop Bar Sandwich Place Pizza Place Asian Restaurant Arts & Crafts Store Burger Joint Bakery Tea Room
1 Mumbai Indian Restaurant Hotel Café Fast Food Restaurant Pizza Place Multiplex Restaurant Vegetarian / Vegan Restaurant Hotel Bar Gym
6 Mumbai Indian Restaurant Hotel Diner Restaurant Flea Market Dance Studio Ice Cream Shop Boat or Ferry Fast Food Restaurant Farmers Market
11 Mumbai Indian Restaurant Hotel Café Restaurant Fast Food Restaurant Coffee Shop Lounge Bar Pub Italian Restaurant
16 Mumbai Indian Restaurant Bus Station Clothing Store Train Station Food Truck Platform Food Food Court French Restaurant Furniture / Home Store
17 Mumbai Indian Restaurant Café Multiplex Restaurant Chinese Restaurant Italian Restaurant Seafood Restaurant Pizza Place Hookah Bar Bar
21 Mumbai Indian Restaurant Chinese Restaurant Café Bakery Coffee Shop Bar Juice Bar Pizza Place Fast Food Restaurant Food Truck
22 Mumbai Indian Restaurant Hotel Café Lounge Restaurant Pizza Place Asian Restaurant Seafood Restaurant Coffee Shop Diner
23 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
24 Mumbai Indian Restaurant Fast Food Restaurant Restaurant Park Vegetarian / Vegan Restaurant Sandwich Place Café Ice Cream Shop Coffee Shop Bakery
26 Mumbai Indian Restaurant Café Electronics Store Sandwich Place Restaurant Chinese Restaurant Asian Restaurant Mexican Restaurant Fast Food Restaurant Snack Place
27 Mumbai Indian Restaurant Restaurant Coffee Shop Fast Food Restaurant Chinese Restaurant Café Dessert Shop Ice Cream Shop Sandwich Place Vegetarian / Vegan Restaurant
28 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
31 Mumbai Indian Restaurant Lounge Café Historic Site Indie Movie Theater Sandwich Place Shopping Mall Burger Joint Restaurant Sports Bar
32 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
33 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
35 Mumbai Indian Restaurant Smoke Shop Multiplex Gym / Fitness Center Gym Café Ice Cream Shop Italian Restaurant Sandwich Place Fast Food Restaurant
38 Mumbai Indian Restaurant Fast Food Restaurant Pizza Place Sports Bar Bar Mobile Phone Shop Farm Diner Restaurant Coffee Shop
39 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
40 Mumbai Indian Restaurant Snack Place Gym Smoke Shop Business Service Café Chinese Restaurant Mughlai Restaurant Asian Restaurant Arts & Crafts Store
42 Mumbai Miscellaneous Shop Playground Café Art Gallery Motorcycle Shop Indian Restaurant Gym / Fitness Center Fast Food Restaurant Field Electronics Store
50 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
52 Mumbai Hot Dog Joint Bus Station Department Store Indian Restaurant Liquor Store Falafel Restaurant Farm Farmers Market Fast Food Restaurant Fish Market
53 Mumbai Indian Restaurant Bakery Coffee Shop Café Restaurant Snack Place Movie Theater Fast Food Restaurant Vegetarian / Vegan Restaurant Multiplex
55 Mumbai Indian Restaurant Café Ice Cream Shop Snack Place Sandwich Place Seafood Restaurant Coffee Shop Electronics Store Food Truck Juice Bar
58 Mumbai Indian Restaurant Fast Food Restaurant Gym / Fitness Center Vegetarian / Vegan Restaurant Playground Coffee Shop Ice Cream Shop Dessert Shop Movie Theater Juice Bar
60 Mumbai Indian Restaurant Pizza Place Juice Bar Coffee Shop Café Electronics Store Bank Bakery Metro Station Multiplex
65 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
66 Mumbai Indian Restaurant Bus Station Clothing Store Train Station Food Truck Platform Food Food Court French Restaurant Furniture / Home Store
67 Mumbai French Restaurant Bakery Platform Indian Restaurant Farmers Market Event Space Factory Falafel Restaurant Farm Field
... ... ... ... ... ... ... ... ... ... ... ...
71 Mumbai Indian Restaurant Restaurant Vegetarian / Vegan Restaurant Lounge Café Bar Gym Fast Food Restaurant Gym / Fitness Center Sporting Goods Shop
75 Mumbai Indian Restaurant Fast Food Restaurant Bakery Coffee Shop Zoo Gym Mediterranean Restaurant Movie Theater Donut Shop Nightclub
77 Mumbai Indian Restaurant Café Ice Cream Shop Market Dessert Shop Fast Food Restaurant Bakery Multiplex Convenience Store Juice Bar
80 Mumbai Indian Restaurant Bar Multiplex Fast Food Restaurant Café Bakery Ice Cream Shop Restaurant Cricket Ground American Restaurant
81 Mumbai Indian Restaurant Café Fast Food Restaurant Bakery Coffee Shop Cricket Ground Italian Restaurant Bar Chinese Restaurant Ice Cream Shop
86 Mumbai Indian Restaurant Café Train Station Multiplex Fast Food Restaurant Chinese Restaurant Coffee Shop Bakery Bar Cricket Ground
87 Mumbai Indian Restaurant Dessert Shop Chinese Restaurant Convenience Store Antique Shop Market Gym Café Arcade BBQ Joint
90 Mumbai Indian Restaurant Coffee Shop Plaza Train Station Cafeteria Chinese Restaurant Bakery Multiplex Playground Restaurant
93 Mumbai Indian Restaurant Breakfast Spot Fast Food Restaurant Café Coffee Shop Juice Bar Bakery Clothing Store Chinese Restaurant Movie Theater
95 Mumbai Indian Restaurant Bakery Café Fast Food Restaurant Cricket Ground Ice Cream Shop Train Station Coffee Shop Gastropub Italian Restaurant
96 Mumbai Indian Restaurant Café Bakery Cricket Ground Gastropub Train Station General Entertainment Coffee Shop Italian Restaurant Juice Bar
99 Mumbai Indian Restaurant Café Ice Cream Shop Bar Italian Restaurant Thai Restaurant Seafood Restaurant Fast Food Restaurant Restaurant Snack Place
100 Mumbai Indian Restaurant Vegetarian / Vegan Restaurant Seafood Restaurant Gym / Fitness Center Bookstore Food Court Park Snack Place Bus Station Electronics Store
102 Mumbai Indian Restaurant Scenic Lookout Café Bakery Ice Cream Shop Dessert Shop Sandwich Place Molecular Gastronomy Restaurant Chinese Restaurant Coffee Shop
103 Mumbai Gym / Fitness Center Light Rail Station Pizza Place Indian Restaurant Bus Station Grocery Store Farm Event Space Factory Falafel Restaurant
104 Mumbai Indian Restaurant Coffee Shop Bakery Platform Mediterranean Restaurant Fast Food Restaurant Soccer Field Restaurant Bar Bank
107 Mumbai Indian Restaurant Café Fast Food Restaurant Snack Place Chinese Restaurant Coffee Shop Vegetarian / Vegan Restaurant Breakfast Spot Movie Theater Bar
108 Mumbai Indian Restaurant Café Fast Food Restaurant Coffee Shop Snack Place Vegetarian / Vegan Restaurant Convenience Store Chinese Restaurant Bar Ice Cream Shop
109 Mumbai Indian Restaurant Café Seafood Restaurant Dessert Shop Fast Food Restaurant Hotel Chinese Restaurant Clothing Store Irani Cafe Parsi Restaurant
110 Mumbai Indian Restaurant Fast Food Restaurant Juice Bar Ice Cream Shop Coffee Shop Restaurant Breakfast Spot Harbor / Marina Gym Italian Restaurant
111 Mumbai Indian Restaurant Bar Multiplex Fast Food Restaurant Café Bakery Ice Cream Shop Restaurant Cricket Ground American Restaurant
112 Mumbai Indian Restaurant Juice Bar Café Restaurant Fast Food Restaurant Train Station Ice Cream Shop Multiplex Chinese Restaurant Market
113 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
114 Mumbai Indian Restaurant Coffee Shop Plaza Train Station Cafeteria Chinese Restaurant Bakery Multiplex Playground Restaurant
116 Mumbai Indian Restaurant Café Fast Food Restaurant Multiplex Coffee Shop Chinese Restaurant Bar Convenience Store Bakery Hotel
117 Mumbai Indian Restaurant Snack Place Shoe Store Sandwich Place Gym / Fitness Center Vegetarian / Vegan Restaurant Dance Studio Diner Lake Grocery Store
118 Mumbai Coffee Shop Playground Indian Restaurant Liquor Store Bus Station Zoo Farmers Market Factory Falafel Restaurant Farm
119 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
120 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground
121 Mumbai Indian Restaurant Café Train Station Chinese Restaurant Bakery Coffee Shop Hotel Seafood Restaurant Multiplex Cricket Ground

62 rows × 11 columns

In [288]:
city_merged.loc[city_merged['Cluster Labels'] == 1, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[288]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
2 Mumbai Bar Pizza Place Gym / Fitness Center Vegetarian / Vegan Restaurant Coffee Shop Pub Snack Place Lounge Indian Restaurant Fish Market
3 Mumbai Pub Chinese Restaurant Café Bar Lounge Seafood Restaurant Indian Restaurant Gym / Fitness Center Coffee Shop Ice Cream Shop
4 Mumbai Hotel Indian Restaurant Café Restaurant Lounge Hotel Bar Asian Restaurant Pizza Place Multiplex Fast Food Restaurant
5 Mumbai Indian Restaurant Chinese Restaurant Café Pub Gym / Fitness Center Ice Cream Shop Bar Gym Italian Restaurant Lounge
7 Mumbai Indian Restaurant Pub Café Bar Lounge Ice Cream Shop Asian Restaurant Pizza Place Coffee Shop Seafood Restaurant
8 Mumbai Café Chinese Restaurant Indian Restaurant Bakery Cupcake Shop Ice Cream Shop Seafood Restaurant Coffee Shop Bar Italian Restaurant
9 Mumbai Restaurant Bed & Breakfast South Indian Restaurant Yoga Studio Hotel Health & Beauty Service Airport Terminal Dance Studio Indian Restaurant Gym
10 Mumbai Coffee Shop Indian Restaurant Hotel Café Airport Fast Food Restaurant Duty-free Shop Bar Restaurant Airport Terminal
12 Mumbai Café Pub Bar Coffee Shop Ice Cream Shop Pizza Place Chinese Restaurant Indian Restaurant Asian Restaurant Seafood Restaurant
13 Mumbai Gym Outdoors & Recreation Beach Farm Motel Resort Performing Arts Venue Field Fast Food Restaurant Farmers Market
14 Mumbai Indian Restaurant Bar Coffee Shop Café Pizza Place Diner Sandwich Place Restaurant Thai Restaurant Chinese Restaurant
15 Mumbai Coffee Shop Café Indian Restaurant Scenic Lookout Tea Room Italian Restaurant Performing Arts Venue Deli / Bodega Hotel Bar Department Store
18 Mumbai Café Coffee Shop Scenic Lookout Indian Restaurant Tea Room Italian Restaurant Donut Shop Fast Food Restaurant Food Truck Boutique
19 Mumbai Indian Restaurant Bakery Italian Restaurant Dessert Shop Café Bar Gym / Fitness Center Cupcake Shop Fast Food Restaurant Lounge
20 Mumbai Indian Restaurant Café Coffee Shop Chinese Restaurant Bar Pizza Place Bakery Snack Place Tea Room Donut Shop
25 Mumbai Food Beach Resort Rest Area Seafood Restaurant Scenic Lookout Event Space Factory Falafel Restaurant Zoo
29 Mumbai Moving Target Boat or Ferry Dance Studio Playground Bridal Shop Dessert Shop Zoo Field Farm Farmers Market
30 Mumbai Restaurant Café Gym Indian Restaurant Chinese Restaurant Snack Place Dessert Shop Italian Restaurant Multiplex Lounge
36 Mumbai Coffee Shop Multiplex Fast Food Restaurant Indian Restaurant Clothing Store Donut Shop Department Store Pizza Place Pub Middle Eastern Restaurant
37 Mumbai Multiplex Coffee Shop Vegetarian / Vegan Restaurant Bar Ice Cream Shop Shopping Mall Seafood Restaurant Breakfast Spot Bistro Clothing Store
41 Mumbai Pharmacy Indian Restaurant Food & Drink Shop Boutique Fast Food Restaurant Bakery Asian Restaurant Arts & Crafts Store Mexican Restaurant Ice Cream Shop
43 Mumbai Sandwich Place Indian Restaurant Electronics Store Café Smoke Shop Jewelry Store Clothing Store Mexican Restaurant Campground Diner
44 Mumbai Miscellaneous Shop Gym / Fitness Center Coffee Shop Motorcycle Shop Art Gallery Chinese Restaurant Indian Restaurant Playground Pizza Place Food Truck
45 Mumbai Fast Food Restaurant Electronics Store Pizza Place Coffee Shop Chinese Restaurant Donut Shop Juice Bar Café Italian Restaurant Pool
46 Mumbai Indian Restaurant Bakery Café Bar Italian Restaurant Gym / Fitness Center Ice Cream Shop Chinese Restaurant Asian Restaurant Cupcake Shop
47 Mumbai Italian Restaurant Lounge Dessert Shop Fast Food Restaurant Bakery Coffee Shop Mexican Restaurant Clothing Store Grocery Store BBQ Joint
48 Mumbai Ice Cream Shop Coffee Shop Fast Food Restaurant Electronics Store Shopping Mall Bar Donut Shop Multiplex Vegetarian / Vegan Restaurant Hotel Bar
49 Mumbai Restaurant Ice Cream Shop Indian Restaurant Asian Restaurant Sandwich Place Bed & Breakfast Coffee Shop College Gym Italian Restaurant Café
51 Mumbai Department Store Pizza Place Ice Cream Shop Gift Shop Snack Place Cosmetics Shop Market Indian Restaurant Gym Tourist Information Center
54 Mumbai Multiplex Ice Cream Shop Pizza Place Diner Platform Bakery Department Store Farm Electronics Store Event Space
56 Mumbai Café Lounge Indian Restaurant Clothing Store Pizza Place Electronics Store Fast Food Restaurant Vegetarian / Vegan Restaurant Asian Restaurant Diner
57 Mumbai Indian Restaurant Fast Food Restaurant Pizza Place Toy / Game Store Chinese Restaurant Factory Light Rail Station Donut Shop Café Indie Movie Theater
59 Mumbai Café Indian Restaurant Clothing Store Electronics Store Diner Fast Food Restaurant Vegetarian / Vegan Restaurant Asian Restaurant Shopping Mall Sporting Goods Shop
61 Mumbai Indian Restaurant Café Hotel Seafood Restaurant Lounge Bar Sandwich Place Snack Place Ice Cream Shop Fast Food Restaurant
62 Mumbai Restaurant Train Station Asian Restaurant Pizza Place Fast Food Restaurant Indian Restaurant Pub Bus Station Falafel Restaurant Event Space
63 Mumbai Hotel Multiplex Coffee Shop Café Department Store Indian Restaurant Grocery Store Pub Falafel Restaurant Event Space
64 Mumbai Indian Restaurant Chinese Restaurant Ice Cream Shop Bar Restaurant Bakery Lounge Coffee Shop Italian Restaurant Fast Food Restaurant
68 Mumbai Indian Restaurant Pizza Place Café Fast Food Restaurant Ice Cream Shop Donut Shop Restaurant Arcade Bakery Bar
72 Mumbai Indian Restaurant Train Station Smoke Shop Sandwich Place Fast Food Restaurant Chinese Restaurant Bar General Entertainment Coffee Shop Platform
73 Mumbai Chinese Restaurant Food Plaza Soccer Field Lounge Café Movie Theater Supermarket Pub Music Venue
76 Mumbai Indian Restaurant Bakery Café Chinese Restaurant Pizza Place Fast Food Restaurant Coffee Shop Sandwich Place Dessert Shop Vegetarian / Vegan Restaurant
78 Mumbai Bakery Café Dessert Shop Sandwich Place Bar Pizza Place Fast Food Restaurant Coffee Shop Park Salon / Barbershop
79 Mumbai Bar Indian Restaurant Chinese Restaurant Pizza Place Fast Food Restaurant Café Bakery Ice Cream Shop Yoga Studio Restaurant
82 Mumbai Train Station Zoo Hotel Furniture / Home Store Fast Food Restaurant Multiplex Pizza Place Plaza History Museum American Restaurant
83 Mumbai Indian Restaurant Spa Chinese Restaurant Coffee Shop Italian Restaurant Shopping Mall Thai Restaurant Men's Store Brewery Mediterranean Restaurant
84 Mumbai Chinese Restaurant Bar Fast Food Restaurant Dessert Shop Indian Restaurant Café Sandwich Place Ice Cream Shop Racetrack Bakery
85 Mumbai Indian Restaurant Coffee Shop Café Fast Food Restaurant Nightclub Dessert Shop Chinese Restaurant Hotel Shopping Mall Italian Restaurant
88 Mumbai Indian Restaurant Café Chinese Restaurant Pizza Place Bakery Fast Food Restaurant Japanese Restaurant Italian Restaurant Seafood Restaurant Coffee Shop
89 Mumbai Indian Restaurant Bakery Café Fast Food Restaurant Dessert Shop Park Racetrack Coffee Shop Pizza Place Department Store
91 Mumbai Indian Restaurant Café Lounge Pub Nightclub Restaurant Shopping Mall Coffee Shop Bar Molecular Gastronomy Restaurant
92 Mumbai Restaurant Coffee Shop Indian Restaurant Lounge Café Chinese Restaurant Art Gallery Hotel Pub BBQ Joint
94 Mumbai Park Restaurant Dessert Shop Lighthouse Ice Cream Shop Indian Restaurant Coffee Shop Gym Event Space Factory
97 Mumbai Chinese Restaurant Fast Food Restaurant Ice Cream Shop Pizza Place Indian Restaurant Bakery Restaurant Racetrack Park Hotel
98 Mumbai Italian Restaurant Restaurant Fast Food Restaurant Indian Restaurant Theater Hotel Coffee Shop Café Pizza Place Mediterranean Restaurant
101 Mumbai Park Restaurant Dessert Shop Lighthouse Ice Cream Shop Indian Restaurant Coffee Shop Gym Event Space Factory
105 Mumbai Fast Food Restaurant Zoo Asian Restaurant History Museum Community Center Pizza Place Dessert Shop Multiplex Flea Market Furniture / Home Store
106 Mumbai Park Ice Cream Shop Chinese Restaurant Basketball Court Pizza Place Restaurant Italian Restaurant Department Store Asian Restaurant Falafel Restaurant
115 Mumbai Indian Restaurant Fast Food Restaurant Bakery Coffee Shop Chinese Restaurant Snack Place Sandwich Place Pizza Place Café Vegetarian / Vegan Restaurant
In [289]:
city_merged.loc[city_merged['Cluster Labels'] == 2, city_merged.columns[[1] + list(range(5, city_merged.shape[1]))]]
Out[289]:
City 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
34 Mumbai Performing Arts Venue Zoo Eastern European Restaurant Food Flower Shop Flea Market Fish Market Field Fast Food Restaurant Farmers Market
In [ ]: